package com.xiaoq.web;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

import com.xiaoq.vo.ErrorMsg;

public class ResponseUtil {

	
	/**
	 * HttpStatus
	 * 	500
	 * 系统内部错误
	 * */
	public static ResponseEntity<?> serverErrorResult(String msg){
		ErrorMsg error = new ErrorMsg(msg);
		return new ResponseEntity<ErrorMsg>(error,HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
	/**
	 * HttpStatus
	 *  400
	 * 参数请求错误
	 * */
	public static ResponseEntity<?> requestErrorResult(String msg){
		ErrorMsg error = new ErrorMsg(msg);
		return new ResponseEntity<ErrorMsg>(error,HttpStatus.BAD_REQUEST);
	}
	
	
	/**
	 * HttpStatus
	 *  200
	 *  返回成功
	 * */
	public static ResponseEntity<?> successResult(Object obj){
		return ResponseEntity.ok(obj);
	}
	
}
